package cn.rkylin.oms.accountreport.adapter;

import cn.rkylin.apollo.common.util.BeanUtils;
import cn.rkylin.oms.common.base.AbstractAdapterFactory;
import cn.rkylin.oms.item.adapter.ItemAdapter;
import cn.rkylin.oms.item.adapter.TaoBaoItemVisitor;
import cn.rkylin.oms.system.shop.vo.ShopVO;

/**
 * 账单适配器工厂
 * 
 * @author jipengcheng
 * @created 2017.04.25
 */
public class AccountreportAdatperFactory extends AbstractAdapterFactory {

	/**
	 * 构造函数
	 */
	private AccountreportAdatperFactory() {
	}

	/**
	 * 判断shopType创建具体的adapter
	 * 
	 * @param shopId
	 * @throws Exception
	 */
	public static AccountreportAdatper getItemAdapter(String shopId) throws Exception {
		AccountreportAdatper accountreportAdapter = null;
		ShopVO shopVO = getShop(shopId);
		if (shopVO == null) {
			return accountreportAdapter;
		}
		String shopType = shopVO.getShopType();
		if (shopVO != null && shopType.equals("淘宝")) {
			accountreportAdapter = BeanUtils.getBean("taoBaoAccountreportAdatper");
			TaoBaoAccountreportVisitor taoBaoAccountreportVisitor = BeanUtils.getBean("taoBaoAccountreportVisitor");
			taoBaoAccountreportVisitor.setShopVO(shopVO);
			accountreportAdapter.setAccountreportVisitor(taoBaoAccountreportVisitor);
		}
		return accountreportAdapter;
	}

}
